<?php
require('../public/connection.php');

checkLogin();

$data = json_decode(file_get_contents('php://input'), true);

$start = $data["pageSize"] * ($data["page"] - 1);

$query = mysqli_query($connect, "select *  from users limit {$start},{$data["pageSize"]};");

$query_data = array();

$count = mysqli_query($connect, "select count(id) as count  from domains;");
if (!$count) {
    die(json_encode(array("code" => 500, "msg" => "服务器异常", "data" => null)));
};
$count = (int) mysqli_fetch_assoc($count)["count"];

while ($item = mysqli_fetch_assoc($query)) {
    $query_data[] = $item;
}

die(json_encode(array("code" => 0, "msg" => "查询成功", "data" => array("user" => $query_data, "num" => $count))));
